xen/arm: vgic: Use dynamic memory allocation for vgic_rdist_region
authorShanker Donthineni <shankerd@codeaurora.org>
Mon, 27 Jun 2016 20:33:37 +0000 (15:33 -0500)
committerStefano Stabellini <sstabellini@kernel.org>
Thu, 14 Jul 2016 14:14:19 +0000 (15:14 +0100)
commit611c1befab88e2bdca34fcf167256d7eb47a6325
treef82f1c73e319f5d9a7e2737ac500787e7bf50ada
parentcede7710119d41d7e32148d22033566a3d3abebe
xen/arm: vgic: Use dynamic memory allocation for vgic_rdist_region

The number of Redistributor regions allowed for dom0 is hardcoded
to a define MAX_RDIST_COUNT which is 4. Some systems, especially
latest server chips, may have more than 4 redistributors. Either we
have to increase MAX_RDIST_COUNT to a bigger number or allocate
memory based on the number of redistributors that are found in MADT
table. In the worst case scenario, the macro MAX_RDIST_COUNT should
be equal to CONFIG_NR_CPUS in order to support per CPU Redistributors.

Increasing MAX_RDIST_COUNT has a effect, it blows 'struct domain'
size and hits BUILD_BUG_ON() in domain build code path.

struct domain *alloc_domain_struct(void)
{
    struct domain *d;
    BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
    d = alloc_xenheap_pages(0, 0);
    if ( d == NULL )
        return NULL;
...

This patch uses the second approach to fix the BUILD_BUG().

Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
Reviewed-by: Julien Grall <julien.grall@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/vgic-v2.c
xen/arch/arm/vgic-v3.c
xen/arch/arm/vgic.c
xen/include/asm-arm/domain.h
xen/include/asm-arm/vgic.h